]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dateMenu: Try harder finding a reasonable weather location name
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 20 Nov 2019 21:15:26 +0000 (22:15 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Sat, 23 Nov 2019 00:13:05 +0000 (01:13 +0100)
Weather stations can have unwieldy long names, which don't fit the
limited space we have available. City names are usually more suitable,
so use the name of the nearest city instead if possible.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1927

js/ui/dateMenu.js

index 4595d6cfb2fd19298142f5958139568b8b5d1924..1e630897bcc93968d05022f8f5ee23ce4ee9f4db 100644 (file)
@@ -388,7 +388,12 @@ class WeatherSection extends St.Button {
         }
 
         let info = this._weatherClient.info;
-        this._titleLocation.text = info.get_location().get_name();
+        let loc = info.get_location();
+        if (loc.get_level() !== GWeather.LocationLevel.CITY && loc.has_coords()) {
+            let world = GWeather.Location.get_world();
+            loc = world.find_nearest_city(...loc.get_coords());
+        }
+        this._titleLocation.text = loc.get_name();
 
         if (this._weatherClient.loading) {
             this._setStatusLabel(_("Loading…"));